#include "Outlier.h"


COutlier::COutlier(void)
{
}


COutlier::~COutlier(void)
{
}
MyLine3D COutlier::getRandLine()
{
	MyLine3D mline;
	mline.setValid(false);
	if(nodeList.size()<5)	return mline;
	for(int m=0;m<500;++m)
	{
		int id=rand()%nodeList.size();
		if(nodeList[id].select>0)	continue;
		
		mline.setStartPoint(nodeList[id].vo.x,nodeList[id].vo.y,nodeList[id].vo.s);

		for(int n=0;n<500;++n)
		{
			int tid=rand()%nodeList.size();
			if(nodeList[tid].select>0)	continue;

			mline.setEndPoint(nodeList[tid].vo.x,nodeList[tid].vo.y,nodeList[tid].vo.s);
			
			if(mline.validLine()&&mline.getLength()>=1&&mline.getLength()<=5)	
			{
				nodeList[id].select++;
				nodeList[tid].select++;
				mline.setValid(true);
				return mline;
			}
		}
	}
	return mline;
}
